package com.newmedia.sounds;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 * 
 * @author christopher
 * 
 * started 2-29-2012, last edited: 2-29-2012 by Chris
 * Developed in Linux, untested on Microsoft and Macintosh computers
 */

public class GUI {

//GUI Class responsible for the GUI of the project.
	private JFrame frame;
	private static JButton PlayMusic;
	//Sets up a JFrame, it's grey, has a title and is useless
		public GUI()
		{
			//create, the JFrame, make it closable
			frame = new JFrame("MusicVisualizer");	
			frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			//Create a simple Title
			JLabel titleLabel = new JLabel("Music Visualizer - CSCE 445");
			titleLabel.setPreferredSize(new Dimension(400,50));
			titleLabel.setFont(new Font("Serif", Font.BOLD, 48));
			frame.getContentPane().add(titleLabel, BorderLayout.NORTH); 
			frame.setLocationRelativeTo(null); 
			//buttons
			getbuttonsReady(this.frame);
			Buttons(this.frame);
			//set the size and show the window.
		//	frame.setSize(800,600); //This makes a big ass GUI
			frame.pack();//this makes a compact one.
			frame.setVisible(true);	
		}
		
		//gets the button ready
		void getbuttonsReady(JFrame frame){
			//initializes and sets the button actions.
			PlayMusic = new JButton("Play Music");
			PlayMusic.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e)
            {
                //Execute when button is pressed
               Sounds buttonsound = new Sounds();
               buttonsound.playSound("C:\\Users\\Jon\\workspace\\MusicVisualizer\\src\\maroon_5-moves_like_jagger_ft_christina_aguilera.mid");
            }
        });      
		}
		
		//for adding buttons to the GUI.
		public static void Buttons(JFrame frame){
			//make the buttons
			Container content = frame.getContentPane();
			content.setLocation(400,300);
			content.setSize(200, 100);
		//	content.setLayout(new FlowLayout()); 
		    content.add(PlayMusic);
		 

			
			
		}
	
}
